import Vue from 'vue'
import VueRouter from 'vue-router'
import devList from '../components/devList.vue'
import gateWay from '../components/gateWay.vue'
import devManager from '../components/devManager.vue'
import buildSetting from '../components/buildSetting.vue'
import Navi from '../components/Navi/Navi'
import login from '../components/Login/Login'
import drag from '../components/drag.vue'
import contextualModel from '../components/contextualModel.vue'
import userManage from '../components/userManage.vue'
import basicSetup from '../components/basicSetup.vue'
import echarts from '../components/echarts.vue'
import echartsOne from '../components/echartsOne.vue'
import echartsTwo from '../components/echartsTwo.vue'

Vue.use(VueRouter)

const router = new VueRouter({
	routes: [{
			path: '/login',
			name: "login",
			component: login
		},
		{
			path: '/Navi',
			name: "Navi",
			component: Navi,
			children: [
				{
					path: '/buildSetting',
					name: "buildSetting",
					component: buildSetting
				}, {
					path: '/devList',
					name: "devList",
					component: devList
				},{
					path: '/gateWay',
					name: "gateWay",
					component: gateWay
				},{
				path:'/devManager',
				name:'devManager',
				component:devManager
				},{
                    path:'/drag',
                    name:'drag',
                    component:drag
				},{
					path:'/contextualModel',
					name:'contextualModel',
					component:contextualModel
				},{
					path:'/userManage',
					name:'userManage',
					component:userManage
				},{
					path:'/basicSetup',
					name:"basicSetup",
					component:basicSetup
				},{
					path:'/echarts',
					name:"echarts",
					component:echarts
				},{
					path:"/echartsOne",
					name:"echartsOne",
					component:echartsOne
				},{
					path:"/echartsTwo",
					name:"echartsTwo",
					component:echartsTwo
				}
			]
		}, {
			path: '/',
			//		component: login,
			name: "login",
			redirect: '/login',
		},
	]
	//	router.beforeEach((to, from, next) => {
	//		if(to.matched.some(res => res.meta.requireAuth)) { // 判断是否需要登录权限
	//			if(sessionStorage.getItem('username')) { // 判断是否登录
	//				next()
	//			} else { // 没登录则跳转到登录界面
	//				next({
	//					path: '/login',
	//					
	//				})
	//			}
	//		} else {
	//			next()
	//		}
	//	})

})

export default router;